use ext::no_std::algebraic::sum::TimeUnit;
use clap::Parser;

/// A CLI tool for compressing and encrypting a file or directory. (tar, lzma, aes & des)

#[derive(Parser)]
#[clap(version = "0.0.0", author = "hzqd <hzqelf@yeah.net>")]
pub struct Args {
    /// Specify the input file name
    #[clap()]
    pub input: String,

    /// Specify the Caesar key
    #[clap(short, long, default_value_t = 0)]
    pub caesar: u8,

    /// Specify the AES key
    #[clap(short, long, default_value = "")]
    pub aes_key: String,

    /// Specify the DES key
    #[clap(short, long, default_value = "")]
    pub des_key: String,

    /// Specify the RSA private key file path
    #[clap(short, long, default_value = "")]
    pub rsa_private_key: String,

    /// Use it to select compress, decompress, or no compress
    #[clap(subcommand)]
    pub compress: Compress,

    /// Specify the time unit, support nanos, micros, millis, secs
    #[clap(short, long, default_value = "secs")]
    pub time: TimeUnit,
}

#[derive(Parser)]
pub enum Compress {
    /// A subcommand for Small dir/file to Simply use Default (De)Compress and multiple (En/De)crypt, file ext name is .vz-s
    S(Tar),
    /// A subcommand for specify using LZMA Compress (If key is empty, no encrypt), file ext name is .vz
    C,
    /// A subcommand for specify to Decompress (If key is empty, no decrypt)
    D,
    /// A subcommand for specify No Compress (Only tar if key is empty), file ext name is .vz-n
    N(Tar),
}

#[derive(Parser)]
pub struct Tar {
    /// Use it to tar a dir (pack files), omit it to unpack
    #[clap(short, long)]
    pub tar: bool,
}

pub fn get_args() -> Args {
    Args::parse()
}
